package com.chuanyang.driverh.mainhome;


import android.content.Intent;
import android.os.Bundle;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.BaseTitleActivity;
import com.chuanyang.driverh.mainhome.fragment.ChooseDriverFragment;
import com.chuanyang.driverh.utils.PrintUtil;

public class ChooseDriverActivity extends BaseTitleActivity {
    private ChooseDriverFragment mFragment;
    @Override
    protected int getContentResId() {
        return R.layout.base_single_fragment_activity;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {

    }

    @Override
    protected void initData() {
//        setResult(1,new Intent());
        setBackImg();
        getTitleTextView().setText("选择司机");
        getRightTextView().setText("确认派单");
        if (mFragment == null) {
            mFragment = new ChooseDriverFragment();
        }
        getSupportFragmentManager().beginTransaction()
                .add(R.id.single_fragment_content, mFragment).commit();
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void baseGoEnsure() {
        if (mFragment.getDriverId()==-1){
            PrintUtil.toast(activityContext,"请选择司机");
            return;
        }
        Intent intent1 = new Intent();
        intent1.putExtra("data", mFragment.getDriverId()+"");
        setResult(1, intent1);
        finish();
    }



}
